package main

import (
	"os"
	"runtime"
	"strings"
)

func setupEnv() {
	if runtime.GOOS == "darwin" {
		pathEnv := os.Getenv("PATH")
		pathMap := map[string]bool{}
		for _, path := range strings.Split(pathEnv, ":") {
			pathMap[path] = true
		}
		tmpList := []string{}
		for _, newPath := range []string{
			"/opt/homebrew/bin",
			"/opt/local/bin",
			"/opt/local/sbin",
			"/usr/local/bin",
			"/usr/local/sbin"} {
			if !pathMap[newPath] {
				tmpList = append(tmpList, newPath)
			}
		}
		tmpList = append(tmpList, pathEnv)
		os.Setenv("PATH", strings.Join(tmpList, ":"))
	}
	os.Setenv("TERM", "xterm")
	os.Setenv("LANG", "c")
}
